import React from 'react'
// ===================================================================== Temp
import TableModal from '#cpt/temp/TableModal'
// ===================================================================== Declare
const { $fn, $Lazy } = window
// ===================================================================== Lazy
const $cache = $Lazy.file(()=>import('#private/cache-api'))
// ===================================================================== component
class Index extends React.Component{
	state = {
		data:[],
		pag: {},
	}
	
	model = {}
	
	componentDidMount(){
		this.cols = this.props.cols
	}
	// 获取表单选择数据
	getSeelct = () => {
		const { forms } = this.state
		$fn.setModalRows(forms, [ 'device_name' ], ()=>{
			$cache.then( async f => {
				// 设备名称
				$fn.setRow(forms, 'device_name',  await f.getCache({ api:'device_result' } ))
				//
				this.setState({ forms })
			})
		})
	}
	
	open = (rows, record) => {
		this.modal.open()
		
		// 搜索参数
		this.query = { update: 0 }
		this.submit = { update:1 }
		//
		this.fetch()
	}
	// paging
	fetch = () => $fn.fetch.call(this, 'result-unit-item/updateDeviceResult', { paging:'get' })
	
	render(){
		return TableModal.call(this,{ title:'手动更新', width:'99%', height:'80%', api:'result-unit-item/updateDeviceResult', table:{ width:1200 }})
	}
}

export default Index